package de.tudarmstadt.ukp.muip.fibqdojo;

import de.tudarmstadt.ukp.muip.fibqdojo.interfaces.IFIBQRule;
import de.tudarmstadt.ukp.muip.fibqdojo.interfaces.IFIBQSentence;

/**
 * This filter should be used in order to select certain sentences from the
 * sentence pool. Compared to the {@link SentenceDropFilterFailAllRules} this
 * class drops a sentence as soon one of the specified rules returns
 * <code>true</code>. Hence, if a rule returns true the sentence is dropped
 * which is quite the opposite behavior of the other above linked sentence drop
 * filter.
 * 
 * @author Tobias Horsmann
 */
public class SentenceDropFilterFailOneRule extends SentenceDropFilterAbstract {

    public SentenceDropFilterFailOneRule(IFIBQRule... filterRules) {
        super(filterRules);
    }

    @Override
    protected boolean keepSentence(IFIBQSentence sentence) {
        for (IFIBQRule rule : filterRules) {
            if (rule.match(sentence)) {
                return false;
            }
        }
        return true;
    }

}
